﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace MobilePlatform.Controllers
{
    public partial class BaseController : Controller
    {
        /// <summary>
        /// 创建分页匿名对象
        /// </summary>
        /// <param name="HrefFormat">Url 格式字符串，
        /// 注意 UrlHelper 会将 {0} 转义，链接到字符串需要占用格式化字符串 {0} 占位符</param>
        /// <param name="pageSize">总页数</param>
        /// <param name="pageIndex">当前页码</param>
        /// <returns>分页匿名对象</returns>
        protected virtual object CreatePager(string HrefFormat, int totalRows, int pageIndex, int pageSize)
        {
            return new
            {
                PageIndex = pageIndex,
                TotalRows = totalRows,
                PageSize = pageSize,
                HrefFormat = Server.UrlDecode(HrefFormat)
            };
        }
    }
}
